class Person:
    def __init__(self, age):
        self.age = age
    def get_age(self):
        return self.age
    def set_age(self, value):
        self.age = value
    def del_age(self):
        del self.age
    x = property(get_age, set_age, del_age)

##属性访问的一些魔法方法：
    def __getattribute__(self, name):
        print("当你访问存在的属性时我会显示出来~")
        return super().__getattribute__(name)
    def __getattr__(self, name):
        print("当你访问不存在的属性时我会显示出来~") 
    def __setattr__(self, name, value):
        print("我知道你在设置属性！")
    def __delattr__(self, name):
        print("为什么删我")
        
## 1
##class Demo:
##    def __getattr__(self, name):
##        return "访问不存在"

## 2
##class Demo:
##    def __getattr__(self, name):
##        print("FishC") 
##    
##    
##    def __setattr__(self, name, value):
##        self.__dict__[name] = value
